package demo1;

import javax.swing.tree.TreeNode;

/*
class Solution {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if (root == null) return null;
        if (p == root || q == root) return root;
        TreeNode leftT = lowestCommonAncestor(root.left,p,q);

        TreeNode rightT = lowestCommonAncestor(root.right,p,q);
        if (leftT != null && rightT != null) {
            return root;
        } else if (leftT != null) {
            return leftT;
        } else {
            return rightT;
        }

    }
}*/
